var app = getApp();
var WxParse = require('../../../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ty_id :"",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var that = this;
    var tt_id = options.tt_id;
    var ty_id = options.ty_id;
    this.setData({
      ty_id: options.ty_id
    })
    var ty_id = options.ty_id;
    this.getTijian_yiyuantaocanxq(tt_id);
    this.getTijian_yiyuantaocan(tt_id);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () { //下拉刷新
    wx.showNavigationBarLoading();
    setTimeout(function () {
      wx.hideNavigationBarLoading();
      wx.stopPullDownRefresh();
    }, 1000);
    var that = this;
    var tt_id = data.tt_id;
    this.getTijian_yiyuantaocanxq(tt_id);
    this.getTijian_yiyuantaocan(tt_id);
  },
  getTijian_yiyuantaocanxq: function (tt_id) {
    var that = this;
    console.log(app);
    app.util.request({
      'url': 'entry/wxapp/Tijian_yiyuantaocanxq',
      'data': {
        tt_id: tt_id,
      },
      'cachetime': '30',
      success: function (res) {
        that.setData({
          tijian_taocanxq: res.data.data,

        })
       
        
      },
      fail: function (err) {
        console.log(err)
      },

    })
  },
  getTijian_yiyuantaocan: function (tt_id) {
    var that = this;
    console.log(app);
    app.util.request({
      'url': 'entry/wxapp/Tijian_yiyuantaocan',
      'data': {
        tt_id: tt_id,
      },
      'cachetime': '30',
      success: function (res) {
        that.setData({
          tijian_taocan: res.data.data,

        })
        WxParse.wxParse('article', 'html', res.data.data.tt_tongzhi, that, 5);
      },
      fail: function (err) {
        console.log(err)
      },

    })
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  yyClick:function(event){
    var tt_id = event.currentTarget.dataset.tt_id;
    var ty_id = event.currentTarget.dataset.ty_id;
    wx:wx.navigateTo({
      url: '../yybianji/yybianji?tt_id='+tt_id+"&ty_id="+ty_id,
    })
  }
})